<!--
 * @Author: ckk
 * @Date: 2022-08-12 13:45:52
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-07-20 13:21:02
 * @Description: 标题组件
-->
<template>
  <div class="title">
    <div class="course-title">
      <div class="line"></div>
      <span class="title-name" :style="{fontSize:datas.setStyle.nameSize+'px',fontWeight:datas.setStyle.nameWeight,color:datas.setStyle.nameColor}">{{ datas.setStyle.name }}</span>
      <span class="title-desc" :style="{fontSize:datas.setStyle.descriptionSize+'px',fontWeight:datas.setStyle.descriptionWeight,color:datas.setStyle.descriptionColor}">{{ datas.setStyle.description || '' }}</span>
    </div>
    <div class="right-button" v-if="datas.setStyle.isShowRight" @click="playVideo(datas.setStyle.rightVideoUrl)">
      <img :src="datas.setStyle.rightPic" alt="">
      <span>{{datas.setStyle.rightText}}</span>
    </div>
  </div>
</template>

<script>
export default {
  name: 'titleComponent',
  props: {
    datas: Object
  },
  data () {
    return {};
  },
  methods: {
    /**
     * @author: ckk
     * @description: 播放视频
     * @param {*} url
     * @return {*}
     */
    playVideo (url) {
      window.location.href = url;
    }
  }
};
</script>

<style scoped lang="scss">
.title {
  display: flex;
  align-items: center;
  padding:0 16px 14px 16px;
  justify-content: space-between;
}
.course-title {
  display: flex;
  align-items: center;
  font-size: 18px;
  font-weight: 600;
  color: #131415;
  flex-shrink: 0;
}
.line {
  width: 4px;
  height: 18px;
  background: linear-gradient(180deg, #77f37a 0%, #53c856 100%);
  border-radius: 16px;
  margin-right: 8px;
  flex-shrink: 0;
}
.title-name{
  flex-shrink: 0;
}
.title-desc {
  font-size: 12px;
  font-weight: 400;
  color: #666666;
  padding-left:12px;
  width: 40%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.right-button{
  display: flex;
  align-items: center;
  font-size: 14px;
  font-family: PingFang SC-Regular, PingFang SC, sans-serif;
  font-weight: 400;
  color: #666666;
  img{
    width:16px;
    height: auto;
    display: block;
    margin-right:2px;
  }
}
</style>
